package com.barneyx.mshinfoplatform.common;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Getter
//@Accessors(chain = true)
public class AliyunOssClient {
    @Value("${alibaba.cloud.accesskey}")
    private String accessId;
    @Value("${alibaba.cloud.secretkey}")
    private String accessKey;
    @Value("${alibaba.cloud.oss.endpoint}")
    private String endpoint;
    @Value("${alibaba.cloud.oss.bucketname}")
    private String bucketName;


    @Bean
    public OSS init(){
        return new  OSSClientBuilder().build(endpoint,accessId,accessKey);
    }
}
